# 删除所有错误容器
kubectl get pods --all-namespaces --field-selector=status.phase=Failed -o jsonpath='{range .items[*]}{.metadata.namespace} {.metadata.name}{"\n"}{end}'  | while read line; do   val1=$(echo $line | awk '{print $1}'); val2=$(echo $line | awk '{print $2}'); kubectl  -n $val1 delete pod $val2 ; done

# 添加定时删除pod的计划任务
(crontab -l 2>/dev/null; echo "0 2 * * * /usr/bin/kubectl -n ylsh delete pod -l app=service-ylsh-web") | crontab -

58 6 * * * /usr/local/bin/kubectl -n sinopec-voc-meshiong rollout restart deployment/service-sinopec-gateway